<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .header{
            height: 50px;
            line-height: 50px;
            font-size: 20px;
            background-color: #f7f7f7;
            border-bottom: 1px solid #ccc;
            text-align: center;
            position: relative;
        }
        .header img{
            position: absolute;
            height: 30px;
            right: 10px;
            top: 10px;
        }
        .header img.leftIcon{
            right: 50px;
        }
        .footer{
            width: 100%;
            height: 90px;
            display: flex;
            position: fixed;
            bottom: 0px;
            border-top: 1px solid #ccc;
        }
        .footer .item{
            text-align: center;
            flex: 1;
        }
    </style>
</head>
<body>
    <div id="box">
        <!-- 调用组件 -->
        <myheader title="书影音" lefticon="images/ic_actionbar_search_icon.png" righticon="images/ic_create_group_chat_blue.png"></myheader>
        <myheader title="我的" righticon="images/ic_settings.png"></myheader>
        <tabbar></tabbar>
    </div>
    <template id="myheaderT">
        <header class="header">
            {{title}} <img :src="lefticon" alt="" class="leftIcon">
                      <img :src="righticon" alt="" class="rightIcon">
        </header>
    </template>
    <template id="tabbarT">
        <footer class="footer">
            <item txt="首页" imgicon="images/1.png"></item>
            <item txt="书影音" imgicon="images/2.png"></item>
            <item txt="广播" imgicon="images/3.png"></item>
            <item txt="小组" imgicon="images/4.png"></item>
            <item txt="我的" imgicon="images/5.png"></item>
        </footer>
    </template>
    <template id="itemT">
        <div class="item">
            <img :src="imgicon" alt="">
            <p>{{txt}}</p>
        </div>
    </template>
    <script src="./js/vue.js"></script>
    <script>
        let vm = new Vue({
            el:"#box",
            data:{

            },
            components:{
                myheader:{
                    props:['title','lefticon','righticon'],
                    template:"#myheaderT",
                },
                tabbar:{
                    template:"#tabbarT",
                    // 定义子组件
                    components:{
                        item:{
                            props:['txt','imgicon'],
                            template:"#itemT"
                        }
                    }
                }
            }
        })
    </script>
</body>
</html>